import * as React from 'react';
import { Button } from 'antd';
import Modal from '../components/Modal'
import { IBookListProps } from '../stores'

export default class CollectionsPage extends React.Component<IBookListProps> {
  public state = {
    visible: false,
  };

  constructor(props: IBookListProps) {
    super(props)
  }

  public showModal = () => {
    this.setState({ visible: true });
  }

  public handleCancel = () => {
    this.setState({ visible: false });
  }

  public render() {
    return (
      <div>
        <Button type="primary" onClick={this.showModal}>添加新书</Button>
        <Modal
          bookStore={this.props.bookStore}
          visible={this.state.visible}
          onCancel={this.handleCancel}
        />
      </div>
    );
  }
}
